Synchronizing related streams

Contents|Index|Previous|Next
Synchronizing related streams

You can use these methods to synchronize related streams with one another:

ostream* ios::tie () const
Method

Report on what output stream, if any, is to be flushed before accessing this one. A pointer value of 0 means no stream is tied.

ostream* ios::tie (ostream* assoc)
Method

Declare that output stream, assoc, must be flushed before accessing this stream.

int ios::sync_with_stdio ([int switch])
Method

Unless iostreams and C stdio are designed to work together, you may have to choose between efficient C++ streams output and output which is compatible with C stdio. Use ‘ios::sync_with_stdio()’ to select C compatibility. The argument, switch, is a GNU extension; since the default value for switch is usually 1, use 0 as the argument to choose output that is not necessarily compatible with C stdio.

If you install the stdio implementation that comes with GNU libio, there are compatible input/output facilities for both C and C++. In that situation, this method is unnecessary—but you may still want to write programs that call it, for portability.

Top|Contents|Index|Previous|Next